home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 4 / MacMania 4.toast / / Demo's / Igor Demo Pro / 1 PutContentsIn Igor Pro Folder / WaveMetrics Procedures / Windows / BringDestToFront next >
Text File  |  1996-01-29  |  1KB  |  52 lines

  1. #pragma rtGlobals=1
  2.  
  3. // This file contains BringDestFront and FindGraphWithWave. The former is
  4. // an old routine that takes a wave name as a string expression. It has been
  5. // extended to work with a data folder path to the wave and also does not rearrange
  6. // the order of windows like the original did.
  7. //
  8. // The new, more modern, routine (that BringDestFront now uses) is
  9. // FindGraphWithWave. It takes an actual wave (reference) and returns
  10. // the name of the graph window.
  11.  
  12.  
  13. // Find topmost graph containing given wave
  14. //    returns zero length string if not found
  15. //
  16. Function/S FindGraphWithWave(w)
  17.     wave w
  18.     
  19.     string win=""
  20.     variable i=0
  21.     
  22.     do
  23.         win=WinName(i, 1)                // name of ith graph window
  24.         if( strlen(win) == 0 )
  25.             break;                            // no more graph wndows
  26.         endif
  27.         CheckDisplayed/W=$win  w
  28.         if(V_Flag)
  29.             break
  30.         endif
  31.         i += 1
  32.     while(1)
  33.     return win
  34. end
  35.  
  36.  
  37. // Bring the first graph window containing a given wave to the front.
  38. // If no such window is found then one is created.
  39. // 960124,LH: Now uses FindGraphWithWave and can take a data folder path.
  40. //
  41. Proc BringDestFront(w)
  42.     string w
  43.     
  44.     string win= FindGraphWithWave($w)
  45.     if( strlen(win) != 0 )
  46.         DoWindow /F $win
  47.     else
  48.         Display $w
  49.     endif
  50. end
  51.  
  52.